package org.devbg.academy.corejava.shop.db.utils;

import java.util.Comparator;

import org.devbg.academy.corejava.shop.db.entities.Product;

public class ProductComparator implements Comparator<Product> {

	public int compare(Product o1, Product o2) {
		if (o1 == o2) {
			return 0;
		} else if (o1 == null) {
			return 1;
		}
		return o1.getName().compareToIgnoreCase(o2.getName());

	}

}
